import java.util.Scanner;



/*就用这个方法吧
* 也算是动态规划*/
class Solution2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine().trim();
            System.out.println(longestPalindrome(s));
        }
    }

    public static String longestPalindrome(String s) {
        int len = s.length();

        String res = s.substring(0, 1);
        for (int a = 0; a < len; a++) {
            int i = a - 1, j = a + 1;
            while (i >= 0 && j < len && s.charAt(i) == s.charAt(j)) {

                i--;
                j++;
            }
            if (res.length() < j - i - 1) {
                res = s.substring(i+1, j);
            }

            i = a;
            j = a + 1;
            while (i >= 0 && j < len && s.charAt(i) == s.charAt(j)) {

                i--;
                j++;
            }
            if (res.length() < j - i - 1) {
                res = s.substring(i+1, j);
            }

        }
        return res;
    }

}
